// $Id$
// Licensed under Apache License Version 2.0
// See: http://www.apache.org/licenses/LICENSE-2.0.html
package de.servicezombie.cxf;

import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class ServletApiAdapterDefaultImpl implements ServletApiAdapter {
	
	ServletApiAdapterDefaultImpl() {}

	HttpServletRequest servletRequest;
	HttpServletResponse servletResponse;
	ServletContext servletContext;

	public String getClientIP() {
		return servletRequest != null ? getServletRequest().getRemoteAddr() : "n.a.";
	}

	public HttpServletRequest getServletRequest() throws IllegalArgumentException {
		return servletRequest;
	}

	public HttpServletResponse getServletResponse() {
		return servletResponse;
	}

	public ServletContext getServletContext() {
		return servletContext;
	}

	@Override
	public String toString() {
		return getClass().getSimpleName() + " [" + getClientIP() + "]";
	}
}
